From 46bb240af617eddcba43f675b0bfef5731c6e9b0 Mon Sep 17 00:00:00 2001 From: robertl Date: Thu, 20 Jul 2006 20:55:21 +0000 Subject: [PATCH] Toss tiny line when reading gpsutil files. git-svn-id: http://gpsbabel.googlecode.com/svn/trunk@2249 f51c46e8-681c-474f-0cfe-069cfd0219fb --- gpsbabel/gpsutil.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/gpsbabel/gpsutil.c b/gpsbabel/gpsutil.c index 768fc5e6f..ed82be57c 100644 --- a/gpsbabel/gpsutil.c +++ b/gpsbabel/gpsutil.c @@ -75,12 +75,17 @@ data_read(void) tin = textfile_init(file_in); while ((ibuf = textfile_read(tin))) { + int n; /* A sharp in column zero or an blank line is a comment */ ibuf = lrtrim(ibuf); if (ibuf[0] == '#' || ibuf[0] == '\n') continue; - sscanf(ibuf, "%s %le%c %le%c %ld%c %30[^,] %c", + n = sscanf(ibuf, "%s %le%c %le%c %ld%c %30[^,] %c", name, &lat, &latdir, &lon, &londir, &alt, &alttype, desc, icon); + /* Require at least first threee fields, otherwise ignore */ + if (n < 3) { + continue; + } desc[0] = '\0'; icon[0] = '\0'; sscanf(&ibuf[39], "%30c", desc); -- 2.30.2